'use strict';
 
function grouping_count(collection) {
    function sortNumber(a,b)
    {
        return a-b
    }
    collection.sort(sortNumber);
    let result={};
    let sum=0;
    for (let i=0;i<collection.length;)
      {
        sum=0;
        for(let j=0;j<collection.length;j++)
          {
            if(collection[i]==collection[j])
              sum+=1;
          }
        result[String(collection[i])]=sum;
        i+=sum; 
      }
    return result;
}

module.exports = grouping_count;
